<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <style>
    body {
      margin: 0;
      padding: 0;
      display: flex;
      width: 100%;
      height: 100vh;
      overflow: hidden;
      align-items: center;
      justify-content: center;
      background: darkseagreen;
    }
    .toggle,
    .switch {
      position: absolute;
      font-size: 30px;
      width: 10em;
      height: 5em;
    }
    .toggle {
      margin: 0;
      visibility: hidden;
    }
    .toggle ~ .switch {
      cursor: pointer;
      background: linear-gradient(silver, whitesmoke);
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 2.5em;
    }
    .toggle ~ .switch .inner {
      width: 8em;
      height: 3.5em;
      background: linear-gradient(dimgray, silver);
      border-radius: 2em;
      box-shadow: inset 0 0 1.5em rgba(0, 0, 0, 0.5);
      display: flex;
      justify-content: center;
    }
    .toggle ~ .switch .inner .desc {
      width: 3.5em;
      height: 3.5em;
      border-radius: 50%;
      background: linear-gradient(to top,silver,whitesmoke);
      box-shadow: 0 .4em .6em rgba(0, 0, 0, 0.2);
      position: relative;
      left: -2.5em;
      display: flex;
      justify-content: center;
      align-items: center;
      transition: .5s;
    }
    .toggle ~ .switch .inner .desc::before{
        content: "OFF";
        position: absolute;
        width: 80%;
        height: 80%;
        background: linear-gradient(silver,whitesmoke);
        text-align: center;
        border-radius: 50%;
        line-height: calc(3.5em * .8);
        color: gray;
    }
    .toggle:checked ~ .switch .inner{
        background: linear-gradient(green,limegreen);
    }
    .toggle:checked ~ .switch .inner .desc{
        transform: translateX(5em);
    }
    .toggle:checked ~ .switch .inner .desc::before{
        content: "ON";
        color: limegreen;
    }
  </style>

  
  <body>
    <input type="checkbox" class="toggle" id="toggle" />
    <label class="switch" for="toggle">
      <div class="inner">
        <div class="desc"></div>
      </div>
    </label>
  </body>
</html>
